﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="EasyValidation.aspx.cs" Inherits="EasyValidation" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>

    <script type="text/javascript" src="jquery/jquery-1.4.2.min.js">
    </script>

    <script type="text/javascript" src="jquery/Jquery.easyvalidate.js"></script>

    <script type="text/javascript">
    $(document).ready(function(){
        $('#tbltest').validate({
            events:{
                blur:true,
                change:true,
                click:false
            },
            rules:{
                txttest:{
                    required:true,
                    maxlength:30,
                    minlength:2,
                    email:true                    
                },
                Text1:{
                    required:true
                },
                <%=txtServer.ClientID%>:{
                    required:true
                },
                Text2:{
                    maxlength:5,
                    number:true
                },
                sletest:{
                    required:true
                }
            },
            messages:{
                txttest:{
                    required:'this field should not be empty',
                    maxlength:'max length should short than 30',
                    minlength:'min length is 2',
                    email:'please input correct e-mail'                    
                },
                Text1:{
                    required:'this field should not be empty'
                },
                <%=txtServer.ClientID%>:{
                    required:'this is server control'
                },
                Text2:{
                    maxlength:'5',
                    number:'only number'
                },
                sletest:{
                    required:'select field test'
                }
            }
        });
    })
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table id="tbltest">
            <tr>
                <td>
                    <input type="text" id="txttest" />
                </td>
                <td>
                    <input type="text" id="Text1" />
                </td>
                <td>
                    <asp:TextBox runat="server" ID="txtServer" Enabled="False"></asp:TextBox>
                </td>
                <td>
                    <input type="text" id="Text2" />
                    <select id="sletest">
                        <option selected="selected" value="">Please Select</option>
                        <option value="1">EAME</option>
                        <option value="2">SWA</option>
                        <option value="3">ASPAC</option>
                        <option value="4">Latin America</option>
                        <option value="5">North America</option>
                        <option value="9">test</option>
                        <option value="10">jgh</option>
                        <option value="11">kjk</option>
                        <option value="12">54</option>
                        <option value="13">而</option>
                        <option value="14">1</option>
                        <option value="15">12</option>
                        <option value="16">色热饭</option>
                        <option value="17">6</option>
                        <option value="18">8</option>
                        <option value="19">9</option>
                        <option value="20">89</option>
                        <option value="21">8989</option>
                    </select>
                </td>
            </tr>
        </table>
    </div>
    <asp:Button ID="Button2" runat="server" CssClass="cancel" OnClick="Button1_Click"
        Text="Cancel" />
    <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
    </form>
</body>
</html>
